package com.javapatterns.observer.variation;

import java.util.ArrayList;
import java.util.List;

public abstract class Subject {

	private List<Watcher> list = new ArrayList<>();
	
	public void add(Watcher watcher){
		list.add(watcher);
	}
	
	public void delete(Watcher watcher){
		list.remove(watcher);
	}
	
	public void notifyObserver(){
		for(Watcher watcher : list){
			watcher.update();
		}
	}
}
